﻿@model IEnumerable<DBTramite.BussinesEntities.T_Unidad>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Unidades de Material Adjunto</h2>

<p>
    @Html.ActionLink("Registrar Nuevo Material", "Create")
</p>
@using (Html.BeginForm())
{
    <fieldset>
        <legend>Buscar Material</legend>
        <b>Descripcion:</b>
        @Html.TextBox("Criterio")
        <input type="submit" name="btnBuscar"  value ="Buscar"/>
    </fieldset> 
}

@*agregamos un 
<div class="datagrid">     antes del TABLE 

<thead> </thead>    despues del table

*@

<div class="datagrid">
<table>
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.codunidad)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.descripcion)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>


@*       
 
    agregamos 
        @{ 
    var row = 0;
    var style = ""; 

        }
    @foreach (var item in Model) {
    
    style = row % 2 == 0 ? "alt" : "";
    
    <tr class="@style">


    </tr>
    row++;


  }*@

@{ 
    var row = 0;
    var style = ""; 
  }
@foreach (var item in Model) {
    
    style = row % 2 == 0 ? "alt" : "";
    
    <tr class="@style">
        <td>
            @Html.DisplayFor(modelItem => item.codunidad)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.descripcion)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new {  id=item.codunidad }) |
            @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
        </td>
    </tr>
    row++;
}
</tbody>
</table>
</div>